﻿using System.Web.Mvc;

namespace Hasiu.Mvc.Infrastructure
{
    public class RedirectOfOtherResult : ActionResult
    {
        private string Url { get; set; }
        private string Alert { get; set; }

        public RedirectOfOtherResult(string alert,string url)
        {
            Url = url;
            Alert = alert;
        }

        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/html";
            context.HttpContext.Response.Write("<script>alert('" + Alert + "');location.href='" + Url + "';</script>");
            context.HttpContext.Response.End();
        }
    }
}
